<script src="../../resources/testharness.js"></script>
<script src="../../resources/testharnessreport.js"></script>
<body>
<script>
test(function(t) {

    var ctx = document.createElement('canvas').getContext('2d');
    
    ctx.fillStyle = 'red';
    ctx.fillRect(0, 0, 1, 1);
    
    assert_equals(ctx.fillStyle, '#ff0000');
    assert_array_equals(ctx.getImageData(0, 0, 1, 1).data, [255, 0, 0, 255]);
    assert_array_equals(ctx.getImageData(1, 0, 1, 1).data, [0, 0, 0, 0]);
    
    ctx.strokeStyle = 'red';
    ctx.lineWidth = 100;
    // NOTE: This version of strokeRect() is WebKit-specific and not part of the standard API.
    ctx.strokeRect(0, 0, 10, 10, 1);
    assert_equals(ctx.lineWidth, 100);
    
    ctx.strokeStyle = 'green';
    ctx.beginPath();
    ctx.moveTo(0, 0);
    ctx.lineTo(20, 20);
    ctx.stroke();
    
    assert_array_equals(ctx.getImageData(2, 2, 1, 1).data, [0, 128, 0, 255]);
    
    document.body.appendChild(ctx.canvas)
    
}, "Test that the rendering context's lineWidth is intact after calling strokeRect()");

</script>
</body>
